package com.zhixing.common;

import lombok.Getter;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring5.SpringTemplateEngine;

/**
 * 模板内容获取工具类
 *
 * @author zhixing
 */
public class TemplateContentFactory {



    @Getter
    public enum TemplateContentType{
        WORD_1("word","word.html")
        ;

        TemplateContentType(String name,String fileName) {
            this.name = name;
            this.fileName = fileName;
        }

        /** 模板名称 **/
        private String name;

        /** 模板文件名 **/
        private String fileName;
    }

    public static String getTemplateContent(TemplateContentType type, Context context,SpringTemplateEngine springTemplateEngine){
        return springTemplateEngine.process(type.name, context);
    }
}
